#!/usr/bin/expect -f

# Disable timeout:
set timeout -1

# Request password with echo disabled:
send_user "Enter VPN password (will be hidden):\n"
stty -echo
expect_user -re "(.*)\n"
stty echo
set pass $expect_out(1,string)

spawn opcon.sh
send_user "VPN connector spawned.\n"
expect "*assword:"
send "$pass\r"
send_user "... Initial password supplied."
expect "*assword:"
send_user "... Enter PIN (will be hidden):\n"
log_file -noappend /tmp/openconnect
interact
